-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Capture git export-subst strings in version.sh for 'git archive' use. #55353
Capture git export-subst strings in version.sh for 'git archive' use. #55353
Conversation
/release-note-none |
hack/lib/version.sh
Outdated
if [[ '$Format:%%$' == "%" ]]; then | ||
KUBE_GIT_COMMIT='$Format:%H$' | ||
KUBE_GIT_TREE_STATE="not a git tree" | ||
if [[ '$Format:%D$' =~ tag:\ (v[^ ]+) ]]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we may want to leave a comment on why this works, something like
"If the archive was created at a git tag vX.Y.Z
, then the ref names will include tag: vX.Y.Z
"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion. Done.
8545270
to
bd62407
Compare
/lgtm I still can't believe this actually works. :) |
Well to be fair, it's already being done in base.go to some degree and you just put the final bow on it and wrapped it up. :) Can't wait to delete the code in k/r! |
hack/lib/version.sh
Outdated
# we likely don't have a git tree, but these magic values may be filled in. | ||
if [[ '$Format:%%$' == "%" ]]; then | ||
KUBE_GIT_COMMIT='$Format:%H$' | ||
KUBE_GIT_TREE_STATE="not a git tree" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wonder if this should be "git archive" instead of "not a git tree"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Precedence, though we could change it. Maybe in both locations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did we want to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To git archive or empty?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git archive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
we can also probably remove the logic in |
well, maybe not. we're not guaranteed that |
@ixdy Do you mean move the other $Format's over to the script? Any reason NOT to do that? |
gitVersion = "v0.0.0-master+$Format:%h$" which will only get overridden by the re: changing |
Is there any reason why staging/src/k8s.io/client-go/pkg/version is not a symlink to pkg/version (or at least some of the files in there)? |
bd62407
to
6b26718
Compare
…lution. Update bad link as well. Prefer master branch untyped values. ref kubernetes#55353.
…lution. Update bad link as well. Prefer master branch untyped values. ref kubernetes#55353.
…lution. Update bad link as well. Prefer master branch untyped values. ref kubernetes#55353.
We export client-go. A symlink will become invalid when client-go is in its own repo. |
Has this been tested with client-go and especially the export of client-go? |
I tested this by ensuring the scripts and go files updated at export, but nothing beyond that. Is there a specific test for client-go we can verify? |
@david-mcmahon you find up-to-date published branches at https://github.com/sttts/client-go. My main question is whether somebody using these library will see the right version when accessing pkg/version. |
@sttts is client-go published from release branches or from master? |
@ixdy both. The release version of client-go comes from the release branch of kube. |
Automatic merge from submit-queue. Use v0.0.0 gitVersion on branches in support of new .gitattributes solution. Update bad link as well. Prefer master branch untyped values. ref #55353.
Automatic merge from submit-queue. Use v0.0.0 gitVersion on branches in support of new .gitattributes solution. Update bad link as well. Prefer master branch untyped values. ref #55353.
Eliminate the need to update pkg/version/base.go on release branch tagging.
This excellent solution brought to you by @ixdy.
Cherrypick to release-1.5 Automated cherry pick of #55353 #55507 @foxishref #16815 (somewhat related)
cc @javier-b-perez